package com.education.welco.controller;


import com.education.welco.pojo.OrderPaperQuestion;
import com.education.welco.service.OrderPaperQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import static com.education.common.core.BaseController.writeJSON;


/**
 * 试卷试题关联表
 *
 * @date 2021-03-04 15:45:19
 */
@RestController
@RequestMapping("/orderpaperquestion")
public class OrderPaperQuestionController {

    @Autowired
    private OrderPaperQuestionService orderPaperQuestionService;

    //添加关联
    @PostMapping("/addpaperquestion")
    public void addpaperquestion(HttpServletResponse response, @RequestBody OrderPaperQuestion orderPaperQuestion) throws IOException {
        writeJSON(orderPaperQuestionService.insertOrderPaperQuestion(orderPaperQuestion),response, "200", "添加成功");
    }

    //删除关联
    @PostMapping("/deletepaperquestion")
    public void deletepaperquestion(HttpServletResponse response,@RequestBody  OrderPaperQuestion orderPaperQuestion, String[] ids) throws IOException{
        writeJSON( orderPaperQuestionService.deleteOrderPaperQuestionByIds(ids),response,"200","删除成功");
    }





}
